package com.itheima.Task;

import com.itheima.common.utils.AliOssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class task {

   @Autowired
   private RedisTemplate redisTemplate;
   @Autowired
   private AliOssUtil aliOssUtil;

    @Scheduled(cron = "0 0 1 * * ? ")
    public void clearImg(){
        Set difference = redisTemplate.opsForSet().difference("waitPass", "uploadSuccess");
        for (Object o : difference) {
            aliOssUtil.delete((String) o);
        }



    }
}
